"use strict"

var Router = require('koa-router');
var config = require('../../../config/config.js');

console.log('router:' + config.baseUrl + '/v1/testv1');
var router = new Router({
    prefix: config.baseUrl + '/v1/testv1'
});

router.get('/', function*() {
    console.log('%s %s', this.method, this.url);
    this.body = 'hello, its works abc xxx';
});

router.get('/a/:id', function*() {
    // console.log('%s %s', this.method, this.url);
    this.body = this.params.id;
});

// /b?x=x1&y=y1
router.get('/b', function*() {
    console.log('%s %s', this.query);
    this.body = JSON.stringify(this.query);
});

/*
{ "hello":"world", "foo":1 }
 */
router.post('/', function*() {
    this.body = this.request.inParams;
});

module.exports = router.routes();